package meconsea.webcoll.sys.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import meconsea.webcoll.base.entity.AbsEntity;
import meconsea.webcoll.base.entity.IEntity;

import org.hibernate.annotations.Type;

@SuppressWarnings("serial")
@Entity
@Table(name="sys_mail")
@NamedQueries({
	@NamedQuery(name=SysMail.FIND_SENDER,query="SELECT O FROM SysMail O WHERE O.senderId=:senderId"),
	@NamedQuery(name=SysMail.FIND_RECEIVER,query="SELECT O FROM SysMail O WHERE O.receiverId=:receiverId"),
	@NamedQuery(name=SysMail.FIND_NO_READ,query="SELECT  COUNT(O.id) FROM SysMail O WHERE O.receiverId=:receiverId and O.isRead=:isRead")
})
public class SysMail extends AbsEntity implements IEntity {
	//发件箱
	public static final String FIND_SENDER = "sysMail_find_sender";
	//收件箱
	public static final String FIND_RECEIVER = "sysMail_find_receiver";
	//未读邮件
	public static final String FIND_NO_READ = "sysMail_find_noread";
	@Column(length=32)
	private String senderId;
	
	@Column(length=32)
	private String receiverId;
	
	@Column(length=128)
	private String title;
	
	@Column(length=512)
	private String content;
	
	@Column(name="mailType")
	@Type(type="integer")
	private int mailType;
	
	@Column(name="isread")
	@Type(type="integer")
	private int isRead;
	
	@Column(length=32)
	private String parentId;

	public String getSenderId() {
		return senderId;
	}

	public void setSenderId(String senderId) {
		this.senderId = senderId;
	}

	public String getReceiverId() {
		return receiverId;
	}

	public void setReceiverId(String receiverId) {
		this.receiverId = receiverId;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public int getMailType() {
		return mailType;
	}

	public void setMailType(int mailType) {
		this.mailType = mailType;
	}

	public int getIsRead() {
		return isRead;
	}

	public void setIsRead(int isRead) {
		this.isRead = isRead;
	}

	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}
}
